﻿<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>骏怡连锁酒店后台管理-新增用户</title>
    <link rel="shortcut icon" href="favicon.ico" type="image/x-icon">
    <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
    <link rel="stylesheet" href="assets/materialize/css/materialize.min.css" media="screen,projection" />
    <!-- Bootstrap Styles-->
    <link href="assets/css/bootstrap.css" rel="stylesheet" />
    <!-- FontAwesome Styles-->
    <link href="assets/css/font-awesome.css" rel="stylesheet" />
    <!-- Custom Styles-->
    <link href="assets/css/custom-styles.css" rel="stylesheet" />
    <!-- Google Fonts-->
    <link href='http://fonts.googleapis.com/css?family=Open+Sans' rel='stylesheet' type='text/css' />
    <style>
        th {
            text-align: center;
        }
        #btnzmx{
         margin-bottom: 20px;
        float: right;
     }
    </style>
</head>

<body>
    <div id="wrapper">
        <nav class="navbar navbar-default top-navbar" role="navigation">
            <div class="navbar-header">
                <button type="button" class="navbar-toggle waves-effect waves-dark" data-toggle="collapse" data-target=".sidebar-collapse">
                    <span class="sr-only">Toggle navigation</span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                </button>
                <a class="navbar-brand waves-effect waves-dark" href="index.html">
                    <i class="large material-icons">track_changes</i>
                    <strong>Hotel Manage</strong>
                </a>

                <div id="sideNav" href="">
                    <i class="material-icons dp48">toc</i>
                </div>
            </div>

            <ul class="nav navbar-top-links navbar-right">
                <li>
                    <a class="dropdown-button waves-effect waves-dark" href="#!" data-activates="dropdown1">
                        <i class="fa fa-user fa-fw"></i>
                        <b id='admin'></b>
                        <i class="material-icons right">arrow_drop_down</i>
                    </a>
                </li>
            </ul>
        </nav>
        <!-- Dropdown Structure -->
        <ul id="dropdown1" class="dropdown-content">
            <li>
                <a href="#">
                    <i class="fa fa-user fa-fw"></i> 个人中心</a>
            </li>
            <li>
                <a href="#">
                    <i class="fa fa-gear fa-fw"></i> 设置</a>
            </li>
            <li id='logoutBtn'>
                <a href="#">
                    <i class="fa fa-sign-out fa-fw"></i> 退出登录</a>
            </li>
        </ul>
<li><a href="#"><i class="fa fa-user fa-fw"></i> 个人中心</a>
                </li>
                <li><a href="#"><i class="fa fa-gear fa-fw"></i> 设置</a>
                </li> 
                <li id='btn'><a href="#"><i class="fa fa-sign-out fa-fw"></i> 退出登录</a>
                </li>
             </ul>

        <!--/. NAV TOP  -->
        <!--/. NAV TOP  -->
        <nav class="navbar-default navbar-side" role="navigation">
            <div class="sidebar-collapse">
                <ul class="nav" id="main-menu">
                    <li>
                        <a class="waves-effect waves-dark" href="index.html">
                            <i class="fa fa-dashboard"></i> 首页</a>
                    </li>
                    <li>
                        <a href="employee.html" class="waves-effect waves-dark">
                            <i class="fa fa-desktop"></i> 员工管理</a>
                    </li>
                    <li>
                        <a href="room.html" class="waves-effect waves-dark">
                            <i class="fa fa-bar-chart-o"></i> 客房管理</a>
                    </li>
                    <li>
                        <a href="role.html" class="waves-effect waves-dark">
                            <i class="fa fa-qrcode"></i>角色管理</a>
                    </li>

                    <li>
                        <a href="user.html" class="active-menu waves-effect waves-dark">
                            <i class="fa fa-table"></i>用户管理</a>
                    </li>
                </ul>

            </div>

        </nav>
        <!-- /. NAV SIDE  -->
        <div id="page-wrapper">
            <div class="header">
                <h1 class="page-header">
                    用户管理
                </h1>
                <ol class="breadcrumb">
                    <li>
                        <a href="#">主页</a>
                    </li>
                    <li>
                        <a href="#">用户管理</a>
                    </li>
                    <li class="active">数据</li>
                </ol>

            </div>
           
            <div id="page-inner">
                <div class="form-group">
                    <label for="username">账号</label>
                    <input  class="form-control" id="username" placeholder="请输入管理员账号" style="width: 300px;">
                </div>
                <div class="form-group">
                    <label for="username">电话</label>
                    <input  type="number" class="form-control" id="phone" placeholder="请输入联系方式" style="width: 300px;">
                </div>
                <div class="form-group">
                    <label for="password">密码</label>
                    <input type="password" class="form-control" id="password" placeholder="请输入管理员密码" style="width: 300px;">
                </div>
                <button id="addBtn" class="btn btn-default">提交</button>
            </div>

            <!-- /. ROW  -->
        </div>
        <!-- /. PAGE INNER  -->
    </div>
    <!-- /. PAGE WRAPPER  -->
    <!-- /. WRAPPER  -->
    <!-- JS Scripts-->


    <!-- jQuery Js -->
    <script src="assets/js/jquery-1.10.2.js"></script>

    <!-- Bootstrap Js -->
    <script src="assets/js/bootstrap.min.js"></script>

    <script src="assets/materialize/js/materialize.min.js"></script>
    <!-- Custom Js -->
    <script src="assets/js/custom-scripts.js"></script>
    <script src="assets/js/public.js"></script>
    <script>
            var username=$('#username');
            var password=$('#password');
            var phone=$("#phone");
            $('#addBtn').click(function(){
                if (username.val().trim() === '' || password.val().trim() === '' || phone.val().trim()==="") {
                    swal('添加失败','用户名或密码不能为空','error');
                    return;
                }
                $.ajax({
                    url:'addUser',
                    method:"POST",
                    data:`username=${username.val().trim()}&password=${password.val().trim()}&phone=${phone.val().trim()}`,
                    success:function(data){
                        if(data=='success'){
                            location.href='user.html';
                        }else{
                            swal('添加失败','系统繁忙','error');
                        }
                    }
                })
            })
        </script>
</body>

</html>